package com.qf.advice;

/**
 * @author 孙亚梅
 * @version V1.0
 * @Project javase2203
 * @Package com.qf.advice
 * @Description:
 * @Date 2022/6/6 16:49
 */

import org.springframework.aop.ThrowsAdvice;

/**
 * 异常通知：
 *      只有代码中报错，发生了异常，才会执行的辅助功能
 */
public class MyExceptionAdvice implements ThrowsAdvice {

    //异常通知中的方法名称必须叫做afterThrowing
    public  void  afterThrowing(Exception ex){

        System.out.println("=====异常通知：只有发生异常才会执行的方法ThrowsAdvice ==============");
        //模拟发生异常
        int i =1/0;
    }


}
